package com.hopu.emp_demo.service.impl;

import com.hopu.emp_demo.dao.EmployeeDAO;
import com.hopu.emp_demo.entity.Employee;
import com.hopu.emp_demo.service.EmployeeService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class EmployeeServiceImpl implements EmployeeService {

    @Autowired
    private EmployeeDAO employeeDAO;


    @Override
    public List<Employee> findAll() {
        return employeeDAO.selectAll();
    }

    @Override
    public Employee findById(Long id) {
        return employeeDAO.selectById(id);
    }

    @Override
    public void add(Employee employee) {
        employeeDAO.insert(employee);
    }

    @Override
    public void modify(Employee employee) {
        employeeDAO.update(employee);
    }

    @Override
    public void removeById(Long id) {
        employeeDAO.deleteById(id);
    }
}
